/*
 ============================================================================
 Name		: RSSBriefView.cpp
 Author	  : JohnLZeng
 Copyright   : Your copyright notice
 Description : CRSSBriefView implementation
 ============================================================================
 */

// INCLUDE FILES
#include <aknviewappui.h>
#include "SHPlatform.h"
#include "RSSBriefView.h"

//copy from ListenVoaAppView.cpp
//#include "ListenVoa.hrh"
//#include <ListenVoa_UID3.rsg>

// ============================ MEMBER FUNCTIONS ===============================
CRSSBriefView::CRSSBriefView()
	{
	// No implementation required
	iContainer = NULL;
	}

CRSSBriefView::~CRSSBriefView()
	{
	DoDeactivate();

	//add your code here ...
	}

CRSSBriefView* CRSSBriefView::NewLC()
	{
	CRSSBriefView* self = new (ELeave) CRSSBriefView();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

CRSSBriefView* CRSSBriefView::NewL()
	{
	CRSSBriefView* self = CRSSBriefView::NewLC();
	CleanupStack::Pop(); // self;
	return self;
	}

void CRSSBriefView::ConstructL()
	{
	BaseConstructL(R_VIEW_RSS_BRIEF);

	//add your code here...
	}
/**
 * 
 * */
TUid CRSSBriefView::Id() const
	{
	return TUid::Uid(EListenVoaRSSBriefViewId);
	}
void CRSSBriefView::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case ECommandOperate:
		case ECommandUpdate:
		case ECommandSenior:
		case ECommandMore:
			break;
		case ECommandRead:
			iContainer->Read();
			break;
		case ECommandRemove:
			iContainer->Remove();
			break;
		case ECommandSetReaded:
			iContainer->SetOld();
			break;
		case ECommandSetUnread:
			iContainer->SetNew();
			break;		
		case ECommandUpdateOnline:
			iContainer->RequestOnline();
			break;
		case ECommandUpdateLocal:
			iContainer->ScanLocal();
			break;		
		case ECommandClearAll:
			iContainer->ClearAll();
			break;
		case ECommandPlayAll:
			iContainer->PlayAll();
			break;
		case ECommandDownloadManageView:
			SHChangeView(EListenVoaDownloadManageViewId);
			break;
		case ECommandSettingView:
			SHChangeView(ESettingViewId);
			break;
		default:
			AppUi()->HandleCommandL(aCommand);
		}
	}
void CRSSBriefView::HandleStatusPaneSizeChange()
	{
	if (iContainer != NULL)
		iContainer->SetRect(ClientRect());
	}

/**
 * 
 * */
void CRSSBriefView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
		TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)
	{
	if (iContainer == NULL)
		{
		iContainer = CRSSBriefContainer::NewL(ClientRect());
		iContainer->SetMopParent(this);
		AppUi()->AddToStackL(*this, iContainer);
		iContainer->UpdateDisplay();
		}
	}
void CRSSBriefView::DoDeactivate()
	{
	if (iContainer != NULL)
		{
		AppUi()->RemoveFromViewStack(*this, iContainer);
		delete iContainer;
		iContainer = NULL;
		}
	}
// End of File
